import { v4 as uuidv4 } from 'uuid'
// 要生成一个随机字符串，且每次不能发生变化，游客身份持久存储
export const getUUID = () => {
    // 先获取本地的uuid
    let uuid_token = localStorage.getItem('UUIDTOKEN');
    // 如果本地没有就生成并存储到本地
    if (!uuid_token) {
        uuid_token = uuidv4()
        localStorage.setItem('UUIDTOKEN', uuid_token)
    }
    // 没有返回值是underfined
    return uuid_token
}